//
//  TitleView.swift
//  SmallParts
//
//  Created by 航汇聚 on 2019/11/12.
//  Copyright © 2019 BellaZhou. All rights reserved.
//

import UIKit
@IBDesignable
class TitleView: UIView {
    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet var contentView: UIView!
    @IBInspectable
       var cornerRadius: CGFloat = 0 {
           didSet {
               layer.cornerRadius = cornerRadius
               layer.masksToBounds = cornerRadius > 0
           }
       }
       @IBInspectable
       var borderWidth: CGFloat = 0 {
           didSet {
               layer.borderWidth = borderWidth
           }
       }
       @IBInspectable
       var borderColor: UIColor? {
           didSet {
            layer.borderColor = borderColor?.cgColor
           }
       }
       override init(frame: CGRect) {
           super.init(frame: frame)
           initialFromXib()
       }

       required init?(coder aDecoder: NSCoder) {
           super.init(coder: aDecoder)
           initialFromXib()
       }
       func initialFromXib() {
        let nib = UINib(nibName: "TitleView", bundle: nil)
        contentView = (nib.instantiate(withOwner: self, options: nil)[0] as! UIView)
        contentView.frame = bounds
        addSubview(contentView)
       }
}
